<?php
	include 'conn.php';
	class clsEssentials
	{
		function LoginProcess($username,$password)
		{	
			$sql = "SELECT COUNT(*) as cntAdmin FROM tbl_users WHERE user_name='".$username."' AND password='".$password."' AND is_active='Y' AND is_admin='Y'";
			$run = mysql_query($sql);
			while ($data = mysql_fetch_array($run))
			{
				$cntAdmin = $data['cntAdmin'];
			}
			return $cntAdmin;
		}
		
		function currentContactNumber()
		{	
			$sql = "SELECT item_value FROM tbl_item_details WHERE item_name='contact-number' AND is_active='Y'";
			$run = mysql_query($sql);
			while ($data = mysql_fetch_array($run))
			{
				$item_value = $data['item_value'];
			}
			return $item_value;
		}
		function currentEmailAddress()
		{	
			$sql = "SELECT item_value FROM tbl_item_details WHERE item_name='contact-email' AND is_active='Y'";
			$run = mysql_query($sql);
			while ($data = mysql_fetch_array($run))
			{
				$item_value = $data['item_value'];
			}
			return $item_value;
		}
		function getFeedBack()
		{
			$sql = "SELECT cus_name,cus_country,cus_feedback,cus_gender FROM tbl_customer_feedback WHERE publish='Y'";
			$run = mysql_query($sql);
			$counter=0;
			$arrFeedback = array();
			while ($data = mysql_fetch_array($run))
			{
				$arrFeedback[$counter]["cus_name"] = stripslashes($data["cus_name"]);
				$arrFeedback[$counter]["cus_country"] = stripslashes($data["cus_country"]);
				$arrFeedback[$counter]["cus_gender"] = stripslashes($data["cus_gender"]);
				$arrFeedback[$counter]["cus_feedback"] = htmlspecialchars($data["cus_feedback"]);
				$counter++;
			}
			return $arrFeedback;
		}
		function getAllFeedBack()
		{
			$sql = "SELECT id,cus_name,cus_country,cus_feedback,cus_gender FROM tbl_customer_feedback WHERE publish='Y'";
			$run = mysql_query($sql);
			$counter=0;
			$arrFeedback = array();
			while ($data = mysql_fetch_array($run))
			{
			$arrFeedback[$counter]["id"] = stripslashes($data["id"]);
				$arrFeedback[$counter]["cus_name"] = stripslashes($data["cus_name"]);
				$arrFeedback[$counter]["cus_country"] = stripslashes($data["cus_country"]);
				$arrFeedback[$counter]["cus_gender"] = stripslashes($data["cus_gender"]);
				$arrFeedback[$counter]["cus_feedback"] = htmlspecialchars($data["cus_feedback"]);
				$counter++;
			}
			return $arrFeedback;
		}
		
		function getAllPackages()
		{
			$sql = "SELECT id,plans,price,validity,pcs,additionalpc FROM tbl_package_details WHERE is_active='Y'";
			$run = mysql_query($sql);
			$counter=0;
			$arrFeedback = array();
			while ($data = mysql_fetch_array($run))
			{
				$arrFeedback[$counter]["id"] = stripslashes($data["id"]);
				$arrFeedback[$counter]["plans"] = stripslashes($data["plans"]);
				$arrFeedback[$counter]["price"] = stripslashes($data["price"]);
				$arrFeedback[$counter]["validity"] = stripslashes($data["validity"]);
				$arrFeedback[$counter]["pcs"] = htmlspecialchars($data["pcs"]);
				$arrFeedback[$counter]["additionalpc"] = htmlspecialchars($data["additionalpc"]);
				$counter++;
			}
			return $arrFeedback;
		}
	}